<?PHP 
include("config.php");
 ?>
 <?PHP include("config.php");
require_once "sql_inject.php"; 
$bDestroy_session = TRUE; 
$url_redirect = 'index.php'; 
$sqlinject = new sql_inject('./log_file_sql.log',$bDestroy_session,$url_redirect)  ; 
require 'config.php';
?>
<script language="JavaScript">
 function blockError(){return true;}
 window.onerror = blockError;
 </script>
<script language=JavaScript>
 function disableselect(e) {
    return false
 } 
 function reEnable() {
    return true
 }
 //if IE4+
 document.onselectstart=new Function ("return false")
 //if NS6
 if (window.sidebar) { 
    document.onmousedown=disableselect
    document.onclick=reEnable
 }
 </script>
<SCRIPT language=JavaScript>
<!--

var message="Gosto do site né safado! ta querendo copiar o que?";


function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")

// --> 
</SCRIPT>
<html>
<head>
<title>logar</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT language=JavaScript>
var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")
</SCRIPT>
<head>
<SCRIPT language=JavaScript>
var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")
</SCRIPT>
<style type=text/css>
body{
scrollbar-face-color:#0066FF; 
scrollbar-highlight-color:#0066FF; 
scrollbar-3dlight-color:#0066FF; 
scrollbar-darkshadow-color:#000000; 
scrollbar-shadow-color:333333; 
scrollbar-arrow-color:0099FF; 
scrollbar-track-color:#000000;
font-family:Arial;
font-size:2;
}
.forms {font-family:arial;
font-size:12px;
font-family:Arial;
background-color:#222222;
color:#DDDDDD;
font-weight:bold;
border:1 solid #FFFFFF}
a {
color:#B30000;
text-decoration: none;
}
a:hover {
color:#B30000;
text-decoration: underline; 
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body background="imagens/fundonews.gif" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div align="center"></div>
<table width="306" height="200" border="0" align="center" cellpadding="2" cellspacing="2" bordercolor="#CCCCCC">
  <!--DWLayoutTable-->
  <tr>
    <td height="59" colspan="3" align="center" valign="top">                                <div align="center"> 
        <?php
	if (empty($_POST['name'])) {
	$login = stripslashes($_COOKIE['login']);
	$login = htmlspecialchars($login,ENT_QUOTES);
echo '<p><strong><font size="1" face="Verdana">RESET DE PERSONAGEM</font></strong></p>
<form name="reset" method="post" action="">
        <table width="90%" border=0 align=center cellpadding=3 cellspacing=3>
          <tbody>
            <tr>
              <td><div align="center"><b>
			  <font size="2">Clique no personagem que deseja resetar.<br><br>';
$query = "select Name from Character where AccountID = '$login'";
$result = mssql_query($query);
for($i=0;$i<mssql_num_rows($result);++$i)
{
$row = mssql_fetch_row($result);
echo '<input name="name" type="submit" value="';
echo $row[0];
echo '" class="forms"> ';
}
$conn=mssql_close();
echo '</div></td>
            </tr>
          </table>
      </form><strong><font size="2"><br><br></font></strong>';
	  }
	  else
	  {
$name = stripslashes($_POST['name']);
$name = htmlspecialchars($name,ENT_QUOTES);
$login = stripslashes($_COOKIE['login']);
$login = htmlspecialchars($login,ENT_QUOTES);
echo '<font size="2">';


if (empty($name)) {
	echo "<BR><BR>Selecione seu personagem!";}
else {
$sql_name_check = "SELECT Name FROM Character WHERE Name='$name' and AccountID = '$login'";
$sql_name_check = mssql_query($sql_name_check); 
$name_check = mssql_num_rows($sql_name_check); 
if ($name_check <= 0){ 
echo "<BR><BR>Este personagem não existe no banco de dados da sua conta."; }
else {

$sql_conect = "SELECT ConnectStat FROM MEMB_STAT WHERE memb___id = '$login'";
$sql_conect = mssql_query($sql_conect); 
$conect = mssql_result($sql_conect, 0,0); 
if ($conect == 1){
echo "<BR><BR>Você precisa estar fora do jogo para resetar."; }
else {

$sql_money1_check = "SELECT Money FROM Character WHERE Money > 49999999 and Name='$name'";
$sql_money1_check = mssql_query($sql_money1_check);
$money1_check = mssql_num_rows($sql_money1_check);
if ($money1_check <= 0){ 
echo "<BR><BR>Voc&ecirc; n&atilde;o tem o dinheiro suficiente no invent&oacute;rio. Ponha 50 milh&otilde;es de zen para resetar."; }
else {
$sql_level_check = "SELECT cLevel FROM Character WHERE Name = '$name' and cLevel > '359'";
$sql_level_check = mssql_query($sql_level_check); 
$level_check = mssql_num_rows($sql_level_check);
if ($level_check <= 0){
echo "<BR><BR>Voc&ecirc; n&atilde;o est&aacute; no level m&aacute;ximo ainda. Avance at&eacute; o level 360 para poder resetar."; }
else {
$sql_resets = "SELECT resets FROM Character WHERE Name = '$name'";
$sql_resets = mssql_query($sql_resets); 
$resets = mssql_result($sql_resets, 0,0); 
if ($resets > 200)
{
echo "<BR><BR>Voc&ecirc; j&aacute; ultrapassou o n&uacute;mero de resets permitido."; }
else {

if ($resets >= 1000) {
$pontos = LevelUpPoint; 
}
$numreset = $resets + 1;
$msquery = "UPDATE Character SET
Experience = '0' ,
cLevel = '1' , 
MapNumber = '0' ,
MapPosX = '123' , 
MapPosY = '130' ,
LevelUpPoint =300*$numreset,
Strength = '25' ,
Dexterity = '25' ,
Vitality = '25' ,
Energy = '25' ,
resets = $numreset, 
Money = Money - 49999999
WHERE Name = '$name'
AND AccountID = '$login'
AND cLevel > '359' 
AND Money >= '49999999'
";
$msresults= mssql_query($msquery) or die(mssql_error());
if($msresults)
{
	echo "<BR><b>$name</b> foi resetado com sucesso!<br>
	Este foi seu reset n&uacute;mero $numreset.<br><BR>
	<font color=#006699>!!! Importante !!!<BR>
	Distribua Seus Pontos Pelo Distribuidor do Site<br>";
	
} else {
	echo "<BR>Erro !<br>";
}

}}}}}}}

	  
	  ?>
      <p>                
  </tr>
  <tr>
    <td width="85" height="25">  
    
    <td width="119" align="right" valign="middle">      <div align="center"><a href="logout.php"><font size="2" face="Courier New"><strong></a></div>
    <td width="82">    
  </tr>
</table>
</body></html>